package com.woniuxy.woniubook.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.woniubook.entity.China;
import com.woniuxy.woniubook.mapper.ChinaMapper;
import com.woniuxy.woniubook.service.ChinaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wugd
 * @since 2022-11-16 02:13:11
 */
@Service
public class ChinaServiceImpl extends ServiceImpl<ChinaMapper, China> implements ChinaService {
    @Autowired
    ChinaMapper chinaMapper ;

    @Override
    public List<China> getProvince() {
        QueryWrapper<China> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pid",0);
        List<China> chinas = chinaMapper.selectList(queryWrapper);
        return chinas;
    }

    @Override
    public List<China> getCitys(int proId) {
        QueryWrapper<China> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pid",proId);
        List<China> chinas = chinaMapper.selectList(queryWrapper);
        return chinas;
    }

    @Override
    public List<China> getAreas(int cityId) {
        QueryWrapper<China> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pid",cityId);
        List<China> chinas = chinaMapper.selectList(queryWrapper);
        return chinas;
    }
}
